<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<title>管理中心</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="/sys-admin/css/general.css" rel="stylesheet" type="text/css">
<link href="/sys-admin/css/main.css" rel="stylesheet" type="text/css">
<script src="/sys-admin/js/jquery.js" type="text/javascript"></script>
</head>
<body>
<h1>
<span class="action-span"><a href="/sys-admin/action/cms/template.php?met=addui">添加模板</a></span>
<span id="search_id" class="action-span1">模板管理</span>
</h1>
<div class="list-div" id="listDiv">
<table cellpadding="3" cellspacing="1">
  <tr>
    <th class="num">#</th>
    <th>名称</th>
    <th>类型</th>
    <th>文件名</th>
    <th>文件路径</th>
    <th>操作</th>
  </tr>
  <{foreach from=$templates item=tp name=i}>
  <tr id="tp_<{$tp.tp_id}>">
	<td class="num"><{$smarty.foreach.i.index+1}></td>
	<td><{$tp.tp_name}></td>
	<td><{if $tp.tp_type == 1}>独立<{else}>共用<{/if}></td>
	<td><{$tp.file_name}></td>
	<td><{$tp.tp_path}></td>
	<td>
	<a href="javascript:delTemplate(<{$tp.tp_id}>);">删除</a>
	<a href="/sys-admin/action/cms/template.php?met=download&id=<{$tp.tp_id}>">下载</a>
	<a href="/sys-admin/action/cms/template.php?met=editui&id=<{$tp.tp_id}>">修改</a>
	</td>
  </tr>
  <{/foreach}>
</table>
</div>
<script type="text/javascript">
function delTemplate(id){
	if(confirm("确定要删除该模板?")){
		$.get('/sys-admin/action/cms/template.php?met=delete&id='+id+'&t='+(new Date().getTime()),null,function(result){
			if($.trim(result) == "1"){
				alert("模板删除成功");
				document.location.reload();
			}else{
				alert("模板删除失败");
			}
		});
	}
}
</script>
</body></html>